package com.zcmyth;

public class ReverseString
{
	public static void main(String[] args) {
		//System.out.println(reverse("Madam, I'm Adam"));
		//table(12);
		//print();
		//System.out.print(largest(new int[] {1,3,2,1,9}));
		//RGB(123,1,33);
		reverse1(0,"12345");
	}
	
	public static String reverse(String s)
	{
		char [] cs = s.toCharArray();
		for(int i=0;i<s.length()/2;i++)
		{
			cs[i] ^= cs[s.length()-i-1];
			cs[s.length()-i-1] ^= cs[i];
			cs[i] ^= cs[s.length()-i-1];
		}
		return new String(cs);
	}
	
	public static void reverse1(int index,String s)
	{
		if(index>=s.length())
			return;
		reverse1(index+1,s);
		System.out.print(s.charAt(index));
	}
	
	
	
	
	/*
	Write function to print the odd numbers from 1 to 99.
	*/
	
	public static void print()
	{
		for(int i=1;i<100;i+=2)
			System.out.print(String.format("%3d",i));
	}
	
	/*
	Find the largest int value in an int array.
	*/
	static int largest(int [] a)
	{
		if(a == null ||a.length == 0)
			return -1;
			
		int l = a[0];
		for(int i=1;i<a.length;i++)
		{
			if(l<a[i])
			l = a[i];
		}
		return l;
	}
	

	
}